uniform extern Texture gDepthTex;

sampler DepthTex = sampler_state
{
	Texture = <gDepthTex>;
	MinFilter = POINT;
	MagFilter = POINT;
	MipFilter = POINT;
	AddressU  = CLAMP;
    AddressV  = CLAMP;
};

void DepthRestorePS(in float2 texCoord : TEXCOORD0, out float4 color : COLOR0, out float depth : DEPTH)
{
    color = float4(0,0,0,1);
    depth = tex2D(DepthTex, texCoord);
}

technique DepthRestore
{
    pass Pass1
    {
		ZWriteEnable = true;
		ZEnable = true;
        PixelShader = compile ps_2_0 DepthRestorePS();
    }
}
